package com.shenmazong.user.controller;

import com.shenmazong.user.utils.AliyunOssUtil;
import com.shenmazong.utils.ResultResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2022/6/25 11:00
 */

@RestController
@Slf4j
@Api(tags = "阿里云OSS文件上传")
@RequestMapping(value = "/aliyunOss")
public class AliyunOssController {

    @PostMapping(value = "/upload")
    public ResultResponse uploadFile(@RequestParam("file") MultipartFile file) {
        String url = AliyunOssUtil.OSS().upload(file);

        return ResultResponse.SUCCESS(url);
    }

}
